<?php

namespace MSDK\Controller;

/**
 * 控制器基类
 * 
 * @since 1.0.0 <2015-03-21> SoChishun <14507247@qq.com> Added.
 */
abstract class AppbaseController extends \Common\Controller\CommonController {

    /**
     * 空操作，用于输出404页面
     * @since 1.0 <2015-3-23> SoChishun Added.
     */
    public function _empty() {
        layout(false);
        $this->display('XPage/404');
    }

    /**
     * 初始化
     * @since 1.0 <2015-3-23> SoChishun Added.
     */
    public function _initialize() {
        // 合并应用模块配置到主模块配置中
        C('AMCNF',  \MSDK\Common\MSDKCnf::$config);
        
        // 全局模板变量赋值
        $this->app_assign();
    }

    /**
     * 应用全局赋值操作
     * @since 1.0 <2015-3-23> SoChishun Added.
     */
    function app_assign() {
        $config=require APP_PATH.MODULE_NAME.'/Install/module.config.php';
        $menus=$config['INSTALL']['2_PERMISSION'];
        $this->assign('menus', $menus);
        // 浏览历史
        //$menu_history = D('Permission')->get_menu_history($this->user_login_data['id']);
        //$this->assign('menus_history', $menu_history['status'] ? $menu_history['info'] : array());
        
    }
}
